package com.snailcatmall.www;


import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;

public class FileReadExample {

    public static void main(String[] args) throws IOException {
        // 创建一个文件路径对象
        Path path = Paths.get("F:\\BaiduNetdiskDownload\\novelai-webui一键包\\novelai-webui-aki-v2\\models\\VAE\\StyleAM-03.safetensors");

        // 读取文件的前 50KB 内容并将其转换为二进制字符串
        try (InputStream is = Files.newInputStream(path)) {
            byte[] buffer = new byte[1024*50];
            int bytesRead = is.read(buffer);
            String text = new String(buffer, Charset.forName("UTF-8"));
            System.out.println(text.indexOf("lora_te_text_model_encoder"));
            // 处理二进制字符串
        }
    }
}
